// src/main/java/com/yourpackage/config/OssConfig.java
package com.reliable.framework.oss.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.reliable.framework.oss.properties.OssProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * OSS 配置类，用于创建和管理 OSS 客户端
 */
@Configuration
public class OssConfig {

    @Autowired
    private OssProperties ossProperties;

    /**
     * 创建并返回一个 OSS 客户端实例
     * @return OSS
     */
    @Bean
    public OSS ossClient() {
        return new OSSClientBuilder().build(
            ossProperties.getEndpoint(),
            ossProperties.getAccessKeyId(),
            ossProperties.getAccessKeySecret()
        );
    }
}